package com.liuhe.demo1;

import java.io.IOException;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        Runtime runtime = Runtime.getRuntime();
        //final对象,获取都是一个对象,获取当前的运行环境
        System.out.println(runtime);
        //获取cpu的线程数
        System.out.println(runtime.availableProcessors());
        //能获取的最大内存
        System.out.println(runtime.maxMemory() / 1024 / 1024);
        //已经获取的总内存大小
        System.out.println(runtime.totalMemory() / 1024 / 1024);
        //JVM剩余内存
        System.out.println(runtime.freeMemory());
        //运行cmd命令
        runtime.exec("notepad");
//        runtime.exec("sleep");
    }
}
